﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="ManageDisease.aspx.cs" Inherits="MyHospital.web.ManageDisease" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     <link  rel="stylesheet" href="Styles/dismanger.css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table>
        <tr>
            <td>
                <div class="dmright">
                <asp:GridView ID="DepartList" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="departId" DataSourceID="lqsDpart" OnSelectedIndexChanged="DepartList_SelectedIndexChanged">
                    <Columns>
                        <asp:BoundField DataField="departId" HeaderText="部门编号" InsertVisible="False" ReadOnly="True" SortExpression="departId"  ItemStyle-Width="160px" ItemStyle-Height="30px"/>
                        <asp:BoundField DataField="departName" HeaderText="部门名称" SortExpression="departName" ItemStyle-Width="250px"/>
                        <asp:CommandField ShowSelectButton="True" />
                    </Columns>
                </asp:GridView>
                </div>
            </td>
            <td>
                <div class="dmleft">
                <asp:GridView ID="DiseaseList" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="disId" DataSourceID="lqsDisease">
                    <Columns>
                        <asp:BoundField DataField="disId" HeaderText="疾病编号" InsertVisible="False" ReadOnly="false" SortExpression="disId"  ItemStyle-Width="160px" ItemStyle-Height="30px"/>
                        <asp:BoundField DataField="disName" HeaderText="疾病名称" SortExpression="disName" ItemStyle-Width="250px"/>
                       <asp:TemplateField ItemStyle-Width="40px">
                    <ItemTemplate>
                        <input type="radio" name="myRadio" value='<%# Container.DataItemIndex.ToString() %>'>
                        </form>
                    </ItemTemplate>
                      <ItemStyle Width="40px"></ItemStyle>
                </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                </div>
                <script type="text/javascript">
                    function setNowRadio(v) {
                        //alert(v);
                        var myForm, objRadio;
                        myForm = document.forms[0];
                        for (var i = 0; i < myForm.length; i++) {
                            if (myForm.elements[i].type == "radio") {
                                objRadio = myForm.elements[i];
                                //alert(objRadio.name);
                                //alert(objRadio.value);
                                if (objRadio.value == v) {
                                    objRadio.checked = true;
                                }
                            }
                        }
                    }
                    <asp:Literal ID="jsLiteral" runat="server"></asp:Literal>
                </script>
            </td>
            <td id="Text" style="padding:0 5px 0 30px;border: 1px solid #ccc;">
                <table>
                    <tr>
                        <asp:Label ID="InsertTitle" runat="server" Text="增加疾病"></asp:Label>
                        <asp:Label ID="UpdateTitle" runat="server" Text="修改疾病"></asp:Label>
                    </tr>
                     <tr>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style1">
                            <asp:Label ID="InsertLableName" runat="server" Text="疾病名称"></asp:Label>
                            <asp:Label ID="UpdateLableName" runat="server" Text="疾病名称"></asp:Label>
                        </td>
                        <td class="auto-style1">
                            <asp:TextBox ID="txtInsertName" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtUpdateName" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                     <tr>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="InsertLableDepart" runat="server" Text="所属部门"></asp:Label>
                            <asp:Label ID="UpdateLableDepart" runat="server" Text="所属部门"></asp:Label>
                        </td>
                        <td>
                            <a ID="departBtn" href="javascript:void(0)">
                            <asp:Button ID="departSelect1" runat="server" Text="选择部门" style="width:150px;height:25px" />
                                </a>
                            <a ID="departBtnUpdate" href="javascript:void(0)"  OnClick="departSelectUpdate_Click">
                            <asp:Button ID="departSelectUpdate" runat="server" Text="选择部门" style="width:150px;height:25px"/>
                                </a>
                        </td>
                    </tr>
                     <tr>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <asp:Button ID="InsertSubmit" runat="server" Text="增加" OnClick="InsertSubmit_Click" />
                            <asp:Button ID="UpdateSubmit" runat="server" Text="修改" OnClick="UpdateSubmit_Click" />
                        </td>
                    </tr>
                     <tr>
                        <td>&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <asp:Label ID="lblMassage" runat="server" ForeColor="Red"></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" TableName="Department">
               </asp:LinqDataSource>
            <asp:LinqDataSource ID="lqsDpart" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName="" TableName="Department"></asp:LinqDataSource>
            <asp:LinqDataSource ID="lqsDisease" runat="server" ContextTypeName="MyHospital.DAL.MyHospitalDataContext" EntityTypeName="" TableName="Disease" Where="departId == @departId">
                <WhereParameters>
                    <asp:ControlParameter ControlID="DepartList" DefaultValue="1" Name="departId" PropertyName="SelectedValue" Type="Int32" />
                </WhereParameters>
            </asp:LinqDataSource>
    </table>
    <table ID="operate">
        <tr><td>
            &nbsp;</td></tr>
        <tr>
            <td>
                <asp:Button ID="insertDisease" runat="server" Text="增加疾病" Width="100px" OnClick="insertDisease_Click"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="deleteDisease" runat="server" Text="删除一条" Width="100px " OnClick="deleteDisease_Click" OnClientClick="javascript:return confirm('真的要删除吗？');"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="deleteAllDisease" runat="server" Text="删除一类" Width="100px " OnClick="deleteAllDisease_Click" OnClientClick="javascript:return confirm('真的要删除吗？');"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Button ID="updateDisease" runat="server" Text="修改疾病" Width="100px" OnClick="updateDisease_Click"/>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td>
                <asp:Label ID="lblMassage1" runat="server" Text=" " ForeColor="Red"></asp:Label>
            </td>
        </tr>
    </table>
     <div id="departSelect" class="departSelect">
             <div id="depart-title" class="depart-title">
                选择增加疾病所在部门
                 <span><a id="closeBtn" href="javascript:void(1)">关闭</a></span>
                 <asp:CheckBoxList ID="chkDepart" runat="server" DataSourceID="lqsDpart" MultiColumn="true" ColumnWidth="100px" RepeatColumns="8"
                     DataTextField="departName" DataValueField="departId" style="width: 900px; height: 430px;"></asp:CheckBoxList>
                 <asp:Button ID="departInsertSubmit" runat="server" Text="确定" style="height:30px;width:100px" OnClick="departInsertSubmit_Click"/>
              </div>
         </div>
    <div id="UpdateDepartSelect" class="UpdateDepartSelect">
             <div id="depart-title1" class="depart-title1">
                选择修改疾病所在部门
                 <span><a id="closeBtn1" href="javascript:void(1)">关闭</a></span>
                 <asp:CheckBoxList ID="chkUpdateDepart" runat="server" DataSourceID="lqsDpart" MultiColumn="true" ColumnWidth="100px" RepeatColumns="8"
                     DataTextField="departName" DataValueField="departId" style="width: 900px; height: 430px;"></asp:CheckBoxList>
                 <asp:Button ID="departUpdateSubmit" runat="server" Text="确定" style="height:30px;width:100px" OnClick="departUpdateSubmit_Click"/>
              </div>
         </div>
    <div id="bg" class="bg">sada</div>
    
    <script type="text/javascript">
        var login1 = document.getElementById('UpdateDepartSelect');
        //  .点击"点击，弹出登陆框",弹出登陆窗口和遮盖层
        var adminBtn1 = document.getElementById('departBtnUpdate');
        adminBtn1.onclick = function () {
            login1.style.display = "block";
            bg.style.display = "block";
            return false;
        }
        //  .点击"关闭",隐藏登陆窗口和遮盖层
        var closeBtn1 = document.getElementById('closeBtn1');
        closeBtn1.onclick = function () {
            login1.style.display = "none";
            bg.style.display = "none";
            return false;
        }
        //  .鼠标拖拽功能
        var login_title1 = document.getElementById('depart-title1');
        login_title1.onmousedown = function (e) {
            e = e || window.event;
            var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
            var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

            var boxX = login.offsetLeft;
            var boxY = login.offsetTop;

            var mouse_in_boxX = x - boxX;
            var mouse_in_boxY = y - boxY;

            document.onmousemove = function (e) {
                var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
                var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

                login.style.left = x - mouse_in_boxX + +'px';
                login.style.top = y - mouse_in_boxY - +'px';
            }
        }

        login_title.onmouseup = function () {
            document.onmousemove = null;
        }
    </script>   
    <script type="text/javascript">
        var login = document.getElementById('departSelect');
        //  .点击"点击，弹出登陆框",弹出登陆窗口和遮盖层
        var adminBtn = document.getElementById('departBtn');
        adminBtn.onclick = function () {
            login.style.display = "block";
            bg.style.display = "block";
            return false;
        }
        //  .点击"关闭",隐藏登陆窗口和遮盖层
        var closeBtn = document.getElementById('closeBtn');
        closeBtn.onclick = function () {
            login.style.display = "none";
            bg.style.display = "none";
            return false;
        }
        //  .鼠标拖拽功能
        var login_title = document.getElementById('depart-title');
        login_title.onmousedown = function (e) {
            e = e || window.event;
            var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
            var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

            var boxX = login.offsetLeft;
            var boxY = login.offsetTop;

            var mouse_in_boxX = x - boxX;
            var mouse_in_boxY = y - boxY;

            document.onmousemove = function (e) {
                var x = e.pageX || e.clientX + (document.body.scrollLeft || document.documentElement.scrollLeft);
                var y = e.pageY || e.clientY + (document.body.scrollTop || document.documentElement.scrollTop);

                login.style.left = x - mouse_in_boxX + +'px';
                login.style.top = y - mouse_in_boxY - +'px';
            }
        }

        login_title.onmouseup = function () {
            document.onmousemove = null;
        }
    </script>   
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
